home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 5
/
Aminet 5 - March 1995.iso
/
Aminet
/
misc
/
amag
/
AM9410_2.lha
/
Haufenweise
/
Programme
/
AllocVecTest.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-07-15
|
673b
|
40 lines
#include "AllocSupport.h"
#include <clib/dos_protos.h>
#define BLOCKGROESSE 2000
#define BLOCKANZAHL 10000
__far APTR memblocks[BLOCKANZAHL];
int main(int argc, char *agrv[])
{
register int i = 0,j;
i = 0;
while (i < BLOCKANZAHL)
{
if (i % 50 == 0) Printf("%5ld\r",i);
j = (rand() % BLOCKGROESSE) + 20;
if (!(memblocks[i++] = MyAllocVec(j,MEMF_PUBLIC)))
{ break; }
}
Printf("%5ld\n",i);
i = 0;
while (i < BLOCKANZAHL)
{
if (i % 50 == 0) Printf("%5ld\r",i);
if (memblocks[i] != 0)
{ MyFreeVec(memblocks[i++]);
}
else
{ break; }
}
Printf("%5ld\n",i);
return 0L;
}